﻿package mortal.game.view.platform
{
    import Message.DB.Tables.*;
    import Message.Public.*;
    import flash.geom.*;
    import mortal.common.global.*;
    import mortal.game.cache.*;
    import mortal.game.resource.*;
    import mortal.game.view.platform.platformTencent.*;
    import mortal.game.view.platform.platformThunder.*;

    public class PlatformVIPGiftsUtil extends Object
    {
        private static var _lv2Gift:TPlatformGift;
        private static var _yearGift:TPlatformGift;

        public function PlatformVIPGiftsUtil()
        {
            return;
        }// end function

        public static function getIconResName() : String
        {
            var _loc_1:* = ResFileConst.Platform37WanVIPGiftIcon;
            switch(ParamsConst.instance.platformCode)
            {
                case PlatformConst.Platform37Wan:
                {
                    _loc_1 = ResFileConst.Platform37WanVIPGiftIcon;
                    break;
                }
                case PlatformConst.PlatformThunder:
                {
                    _loc_1 = ResFileConst.PlatformThunderVIPGiftIcon;
                    break;
                }
                case PlatformConst.PlatformSHUNWANG:
                {
                    _loc_1 = ResFileConst.PlatformShunWangVipIcon;
                    break;
                }
                default:
                {
                    break;
                }
            }
            return _loc_1;
        }// end function

        public static function getPanelData() : PlatformVIPGiftShowData
        {
            var _loc_1:PlatformVIPGiftShowData = null;
            _loc_1 = new PlatformVIPGiftShowData();
            switch(ParamsConst.instance.platformCode)
            {
                case PlatformConst.Platform37Wan:
                {
                    break;
                }
                case PlatformConst.PlatformThunder:
                {
                    _loc_1.bgResName = ImagesConst.platformThunderBg1;
                    _loc_1.title = "迅雷牛X金钻礼包";
                    _loc_1.specialClass = PlatformThunderVipPanel;
                    _loc_1.size = new Point(886, 595 + 5);
                    break;
                }
                case PlatformConst.PlatformSHUNWANG:
                {
                    _loc_1.bgResName = ImagesConst.PlatformShunWangBg;
                    _loc_1.title = "顺网会员";
                    break;
                }
                default:
                {
                    break;
                }
            }
            return _loc_1;
        }// end function

        public static function getReceiveTypeByTPlatformGift(param1:TPlatformGift, param2:Boolean = true) : int
        {
            var _loc_3:int = 0;
            var _loc_4:* = Cache.instance.platform.proxyVipInfo;
            if (PlatformConst.isQQ() && PlatformTencentUtil.isPast())
            {
                _loc_3 = PlatformVIPGiftGroup.UnReceive;
                return _loc_3;
            }
            if (_loc_4)
            {
                if (param1.extend == 1)
                {
                    if (_loc_4.proxyExtend >= param1.extend)
                    {
                        _loc_3 = PlatformVIPGiftGroup.CanReceive;
                    }
                    else
                    {
                        _loc_3 = PlatformVIPGiftGroup.UnReceive;
                    }
                }
                else if (_loc_4.proxyLv >= param1.pLv)
                {
                    _loc_3 = PlatformVIPGiftGroup.CanReceive;
                }
                else
                {
                    _loc_3 = PlatformVIPGiftGroup.UnReceive;
                }
            }
            else
            {
                _loc_3 = PlatformVIPGiftGroup.UnReceive;
            }
            var _loc_5:* = Cache.instance.platform.platformGiftInfo;
            var _loc_6:int = 0;
            while (_loc_6 < _loc_5.length)
            {
                
                if (_loc_5[_loc_6] == param1.id)
                {
                    _loc_3 = PlatformVIPGiftGroup.HasReceive;
                }
                _loc_6++;
            }
            if (!param2 && _loc_3 == PlatformVIPGiftGroup.CanReceive)
            {
                if (_loc_4.proxyLv != param1.pLv)
                {
                    _loc_3 = PlatformVIPGiftGroup.UnReceive;
                }
            }
            return _loc_3;
        }// end function

        public static function get lv2Gift() : TPlatformGift
        {
            if (!_lv2Gift)
            {
                if (PlatformGiftConfig.instance.vipGiftVec)
                {
                    _lv2Gift = PlatformGiftConfig.instance.vipGiftVec[1];
                }
            }
            return _lv2Gift;
        }// end function

        public static function get yearGift() : TPlatformGift
        {
            if (!_yearGift)
            {
                if (PlatformGiftConfig.instance.vipGiftVec)
                {
                    _yearGift = PlatformGiftConfig.instance.vipGiftVec[(PlatformGiftConfig.instance.vipGiftVec.length - 1)];
                }
            }
            return _yearGift;
        }// end function

        public static function isCompThunder() : Boolean
        {
            var _loc_1:int = 2;
            if (PlatformVIPGiftsUtil.getReceiveTypeByTPlatformGift(PlatformVIPGiftsUtil.lv2Gift) == PlatformVIPGiftGroup.HasReceive)
            {
                _loc_1 = _loc_1 - 1;
            }
            if (PlatformVIPGiftsUtil.getReceiveTypeByTPlatformGift(PlatformVIPGiftsUtil.yearGift) == PlatformVIPGiftGroup.HasReceive)
            {
                _loc_1 = _loc_1 - 1;
            }
            return _loc_1 == 0;
        }// end function

        public static function hasThunderGift() : Boolean
        {
            var _loc_1:Boolean = false;
            if (PlatformVIPGiftsUtil.getReceiveTypeByTPlatformGift(PlatformVIPGiftsUtil.lv2Gift) == PlatformVIPGiftGroup.CanReceive)
            {
                _loc_1 = true;
            }
            if (PlatformVIPGiftsUtil.getReceiveTypeByTPlatformGift(PlatformVIPGiftsUtil.yearGift) == PlatformVIPGiftGroup.CanReceive)
            {
                _loc_1 = true;
            }
            return _loc_1;
        }// end function

    }
}
